



#import "JddUICheckBox.h"

@implementation JddUICheckBox

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackGroundImage];
    }
    return self;
}
- (void)setBackGroundImage {
    [self setBackgroundImage:[UIImage imageNamed:@"jdd_checkbox_no"] forState:UIControlStateNormal];
    [self setBackgroundImage:[UIImage imageNamed:@"jdd_checkbox_yes"] forState:UIControlStateSelected];
    [self addTarget:self action:@selector(touchUIInside:) forControlEvents:UIControlEventTouchUpInside];
}

-(id)initWithCoder:(NSCoder *)aDecoder{
    self =  [super initWithCoder:aDecoder];
    if (self) {
        [self setBackGroundImage];
    }
    return self;
}

-(IBAction)touchUIInside:(id)sender{
    JddUICheckBox* cb= (JddUICheckBox*)sender;
    cb.selected = !cb.selected;
    
}

@end